//
//  WithdrawFirstTopCell.m
//  GasBusiness
//
//  Created by zfc on 2021/8/1.
//

#import "WithdrawFirstTopCell.h"

@interface WithdrawFirstTopCell ()

@property (nonatomic, strong) UILabel *totalLab;
@property (nonatomic, strong) UILabel *usableLab;

@end

@implementation WithdrawFirstTopCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setUI {

    self.contentView.backgroundColor = ColorF5;
    UIView *backView = [[UIView alloc] init];
    backView.cornerRadius = 8;
    backView.backgroundColor = WhiteColor;
    [self.contentView addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.leading.equalTo(self.contentView).offset(15);
        make.top.equalTo(self.contentView).offset(5);
    }];

    UILabel *lab = [[UILabel alloc] init];
    lab.text = @"总金额(元)";
    lab.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
    lab.textColor = Color333;
    [backView addSubview:lab];
    [lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(backView).offset(27);
        make.centerX.equalTo(backView);
    }];

    UILabel *totalLab = [[UILabel alloc] init];
    totalLab.text = @"";
    totalLab.font = [UIFont systemFontOfSize:32 weight:UIFontWeightMedium];
    totalLab.textColor = Color333;
    [backView addSubview:totalLab];
    self.totalLab = totalLab;
    [totalLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(backView).offset(58);
        make.centerX.equalTo(backView);
    }];

    UILabel *usableLab = [[UILabel alloc] init];
    usableLab.text = @"";
    usableLab.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
    usableLab.textColor = Color333;
    [backView addSubview:usableLab];
    self.usableLab = usableLab;
    [usableLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(backView).offset(-26);
        make.centerX.equalTo(backView);
    }];
}


- (void)setDic:(NSDictionary *)dic {
    _dic = dic;

    self.totalLab.text = dic[@"user_money"];
    self.usableLab.text = [NSString stringWithFormat:@"%.2f", [dic[@"user_money"] floatValue] - [dic[@"frozen_money"] floatValue]];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
